Abhijit Nadgouda has an entire category of posts on “WordPress Global Variables” that are worth exploring if you are writing WordPress Plugins, WordPress Widgets, or messing around with WordPress Themes and template tags.
Here are some great highlights of the many WordPress Global Variables Nadgouda has written about:
- Dates: month, weekday_abbrev, weekday, monthnum, m (by “moment in time”), and day
- Post and Page Variables: wp_query, posts, more, posts_per_page, max_num_pages, numpages, page, pages, multipage, paged, post, id, authordata, post_cache, category_cache, and post_meta_cache
- Browser and Server Detection: is_winIE or is_macIE, is_IIS, is_apache, and wp_db_version
- Internationalization/Localization: l10n and locale
- Behavior Variables: wp_filter, richedit, page_cache, pagenow, wp_version, table_prefix,wp,admin_page_hooks, wp_object_cache, allowedposttags, allowedtags, and wp_rewrite
- User Data: wp_roles, user_pass_md5, user_url, user_login, user_level, user_identity, user_email, user_ID, current_user, and wpdb
You can see the full list of WordPress Global Variables by Nadgouda to find new articles and the ones I missed, and find more technical information about the various WordPress Global Variables, WordPress Hooks, WordPress Functions, and Conditional Tags at:
- Plugin API from the WordPress Codex
- WordPress Codex – WordPress Filters
- WordPress Function Reference
- WordPress Pluggable Functions
- Writing a Plugin
- Displaying Posts Using a Custom Select Query
- WordPress Coding Standards
- WordPress Conditional Tags
- WordPress Database Description
- Adding Administration Menus to Plugins
- Creating Tables with Plugins
- WordPress Hooks from Flat Earth
- Using Custom Fields
- Understanding the WordPress Loop
- Customizing the WordPress Loop
- WordPress Template Hierarchy
- How to Pass WordPress Tag Parameters
Related Articles
- WordPress Pluggable Functions and Plugins by Nadgouda
- WordPress Hooks – All of Them
- WordPress Hooks
- Problem Solving the WordPress Header
- Customizing Your Feed Titles
- Separating Comments and Trackbacks in WordPress – The Answer
- HTML, CSS, PHP, and More Cheat Sheets
- Creating Multiple Single Posts for Different Categories
- WordPress Tips and Tricks for Template Files
- Show Just One Category in WordPress Categories
- Using Javascript in WordPress
- Customizing WordPress Administration Panels
- Search and Replace in WordPress MySQL Database
- How to Write a Simple WordPress Plugin
- InfoRapid Multiple Files Search and Replace Across Multiple Files
- Creating a “Bad Code Day” Error Message for Your Blog
- Video How To – Writing Your First WordPress Plugin
- How to Put Javascript in External Files
- Using Author Template Tags Outside of the WordPress Loop
- WordPress Category Feed Links in Your Post Meta Data Section
- Display Post Excerpts Only in WordPress
- Your Comment Has Been Moderated – Stay Tuned for Approval
- When the Blog Breaks: Fixing Your Broken Blog
- When The Blog Breaks: Site Monitoring
Site Search Tags: wordpress, wordpress global variables, wordpress variables, wordpress hooks, wordpress plugins, customizing wordpress, wordpress template tags, wordpress template files, wordpress theme, wordpress loop, wordpress code, wordpress tips
Copyright Lorelle VanFossen, member of the 9Rules Network
4 Comments
Thanks for highlighting it Lorelle. The reason I set out to document the global variables was because I got confused while working on some projects. Though global variables are very convenient to work with, change in them can impact the entire application, and hence this effort so that users can knowingly use the them.
BEAUTIFUL!
You can’t imagine how many times I’ve wanted to know these variables in order to output custom pieces of information in my WordPress themes.
Abhijit: Thank you! thank you! thank you!
i want to declare a variable in any file of wordpress and then i want to use its value on any page of wordpres, let me explain you what i want to do and what i did
step 1. i declared a variable in functions.php file like this
global $test;
$test = ‘2’;
step 2. Now i wrote this in header.php file
echo $test ; die;
But the value in variable is not showing in header, actually i want the value to be shown in footer,
I recommend you define it as a constant such as:
define('TEST', 2);
The code should be inserted into the header as php:
<?php echo TEST; ?>
6 Trackbacks/Pingbacks
[…] A definitive WordPress coding reference can be found on Lorelle on WordPress. There’s mention of a list of global WordPress variables by Abhjit Nadgouda, but to be honest I’ve read it, and found it dryer than a salt cracker. Still Abhjit has a nice web layout, worth the visit if only to see the Opera like pop-up web link previews. […]
[…] Abhijit Nadgouda’s List of WordPress Global Variables […]
[…] Abhijit Nadgouda’s List of WordPress Global Variables […]
[…] Abhijit Nadgouda’s List of WordPress Global Variables […]
[…] Abhijit Nadgouda’s List of WordPress Global Variables […]
[…] Abhijit Nadgouda’s List of WordPress Global Variables […]